import 'package:flutter/cupertino.dart';
import 'package:flutter_base/bean/knowledge/knowlege_entity.dart';
import 'package:flutter_base/http/api.dart';

///
/// @DIR_PATH：lib/viewmodel/knowledge
/// @TIME：2024/6/12 17:15
/// @AUTHOR：starr
///
class KnowledgeViewModel with ChangeNotifier {
  List<KnowlegeData>? entity;

  Future knowledgeList() async {
    entity = await Api.instance.getKnowledgeListData();
    notifyListeners();
  }

  String getSubTitle(List<KnowlegeDataChildren?>? children) {
    if (children == null || children.isEmpty == true) {
      return "";
    }
    StringBuffer stringBuffer = StringBuffer("");
    for (var e in children) {
      stringBuffer.write("${e?.name}\n");
    }
    return stringBuffer.toString();
  }
}
